<?php
namespace App\HttpController\Admin;

use App\Common\Controller\Common;

class Upload extends Common
{
    /**
     * 登录
     */
    public function POSTIndex()
    {
        $file = request()->file('file');
        $this->abort($file, '请上传文件');
        $info = $file->validate(['ext' => 'jpg,png,gif'])->move(ROOT_PATH . DS . 'public' . DS . 'uploads');
        $this->abort($info, '文件上传失败');
        $this->checkRes($info, 'uploads' . '/' . str_replace('\\', '/', $info->getSaveName()), $file->getError());
    }
}
